package org.hjj.design.u95.storage;

import org.hjj.design.u95.domain.RequestInfo;

import java.util.List;
import java.util.Map;

/**
 * interface of metrics storagee
 *
 * @author:何嘉俊
 * @date:2021/5/17
 */
public interface MetricsStorage {

    /**
     * save request info {@link RequestInfo}
     * @param requestInfo
     */
    void saveRequestInfo(RequestInfo requestInfo);

    /**
     * query request info by api name between start time and end time.
     * @param apiName
     * @param startTimeInMillis
     * @param endTimeInMillis
     * @return
     */
    List<RequestInfo> getRequestInfos(String apiName, long startTimeInMillis, long endTimeInMillis);

    /**
     * query request info between start time and end time
     * @param startTimeInMillis
     * @param endTimeInMillis
     * @return
     */
    Map<String, List<RequestInfo>> getRequestInfos(long startTimeInMillis, long endTimeInMillis);
}
